package com.chen.springboot.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chen.springboot.entity.ItemImage;
import com.chen.springboot.mapper.ItemImageMapper;
import com.chen.springboot.service.ItemImageService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ItemImageServiceImpl extends ServiceImpl<ItemImageMapper, ItemImage> implements ItemImageService {

    @Override
    public List<ItemImage> getImagesByItemId(Long itemId) {
        QueryWrapper<ItemImage> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("item_id", itemId);
        queryWrapper.orderByAsc("sort_order");
        return this.list(queryWrapper);
    }
}


